using System.Collections;
using System.Runtime.Serialization;
using System.Web;

namespace WebMonitor.Http.Impl {
    /// <summary>
    /// Summary description for HttpApplicationStateAdapter.
    /// </summary>
    public class HttpApplicationStateAdapter : IHttpApplicationState {
        private readonly HttpApplicationState app;

        public HttpApplicationStateAdapter(HttpApplicationState app) {
            this.app = app;
        }

        public void Add(string name, object value) {
            app.Add(name, value);
        }

        public void Set(string name, object value) {
            app.Set(name, value);
        }

        public void Remove(string name) {
            app.Remove(name);
        }

        public void RemoveAt(int index) {
            app.RemoveAt(index);
        }

        public void Clear() {
            app.Clear();
        }

        public void RemoveAll() {
            app.RemoveAll();
        }

        public object Get(string name) {
            return app.Get(name);
        }

        public object Get(int index) {
            return app.Get(index);
        }

        public string GetKey(int index) {
            return app.GetKey(index);
        }

        public void Lock() {
            app.Lock();
        }

        public void UnLock() {
            app.UnLock();
        }

        public object this[string name] {
            get { return app[name]; }
            set { app[name] = value; }
        }

        public object this[int index] {
            get { return app[index]; }
        }

        public string[] AllKeys {
            get { return app.AllKeys; }
        }

        public IHttpApplicationState Contents {
            get { return new HttpApplicationStateAdapter(app.Contents); }
        }

        public HttpStaticObjectsCollection StaticObjects {
            get { return app.StaticObjects; }
        }

        public void GetObjectData(SerializationInfo info, StreamingContext context) {
            app.GetObjectData(info, context);
        }

        public void OnDeserialization(object sender) {
            app.OnDeserialization(sender);
        }

        public IEnumerator GetEnumerator() {
            return app.GetEnumerator();
        }
    }
}